﻿using System;

namespace GenericityArray
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] one = { 1, 2, 3 };
            int[] two = { 1, 2 };
            double[] dou1 = { 1.1, 2.2, 3.3 };
            double[] dou2 = { 1.1, 2.2 };
            var result = Array(dou1, dou2);
            Console.Write(string.Join(",", result));
        }
        static T[] Array<T>(T[] a, T[] b)
        {
            T[] array = new T[a.Length + b.Length];
            int ai = 0, bi = 0, zi = 0;
            do
            {
                if (ai < a.Length) array[zi++] = a[ai++];
                if (bi < b.Length) array[zi++] = b[bi++];

            } while (ai < a.Length || bi < b.Length);
            return array;
        }
    }
}
